package lanqiao;

import java.util.Arrays;

public class menpaizhizuo {
public static void main(String[] args) {
	int i,ans=0;
	for ( i = 1; i <= 2020; i++) {
		int m = i;
		while(m!=0) {
			if(m%10==2) {
				ans++;
			}
			m=m/10;
		}
	}
	System.out.println(ans);
	
}
}
